#!/usr/bin/env python3

import sys
import time

def print_process_bar(iteration, total, length=40):
    process = iteration / total
    arrow = '=' * int(round(process * length) - 1)
    spaces = ' ' * (length - len(arrow))
    sys.stdout.write(f'\r[{arrow}{spaces}] {int(process * 100)}% ({iteration}/{total})')
    sys.stdout.flush()

total = 50
for i in range(total):
    time.sleep(0.1)
    if i & 0x07 == 0x07 :
        print(f"\ni={i}\n")
    print_process_bar(i + 1, total)

print()